﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 课堂作业_大小排序
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = new int[10] { 97, 65, 32, 17, 58, 43, 79, 81, 23, 10 };
            int k = numbers[0];
            for (int i = 0; i < numbers.Length-1; i++)
            {
                for (int j = 0; j < numbers.Length-i-1; j++)
                {
                    if (numbers[j]>numbers[j+1])
                    {
                        k = numbers[j+1];
                        numbers[j+1] = numbers[j ];
                        numbers[j] = k;
                    }
                }     
            }
            Console.Write("数组排序为：");
            foreach (int item in numbers)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine();
            Console.WriteLine("最大数字为：" + numbers[9]);
            Console.WriteLine("最小数字为：" + numbers[0]);
            Console.ReadKey();
        }
    }
}
